load("//bazel:tachyon_cc.bzl", "tachyon_cc_library", "tachyon_cc_unittest")

package(default_visibility = ["//visibility:public"])

tachyon_cc_library(
    name = "buffer",
    srcs = ["buffer.cc"],
    hdrs = ["buffer.h"],
    deps = [":read_only_buffer"],
)

tachyon_cc_library(
    name = "copyable",
    hdrs = ["copyable.h"],
    deps = [
        ":buffer",
        ":copyable_forward",
        "//tachyon/base:logging",
        "@com_google_absl//absl/types:span",
    ],
)

tachyon_cc_library(
    name = "copyable_forward",
    hdrs = ["copyable_forward.h"],
    deps = ["//tachyon/base/types:cxx20_is_bounded_array"],
)

tachyon_cc_library(
    name = "endian_auto_reset",
    hdrs = ["endian_auto_reset.h"],
    deps = [
        ":buffer",
        "//tachyon:export",
    ],
)

tachyon_cc_library(
    name = "read_only_buffer",
    srcs = ["read_only_buffer.cc"],
    hdrs = ["read_only_buffer.h"],
    deps = [
        ":copyable_forward",
        "//tachyon/base:endian",
        "//tachyon/base/numerics:checked_math",
        "@com_google_absl//absl/base:endian",
    ],
)

tachyon_cc_library(
    name = "string_buffer",
    hdrs = ["string_buffer.h"],
    deps = [":buffer"],
)

tachyon_cc_library(
    name = "vector_buffer",
    srcs = ["vector_buffer.cc"],
    hdrs = ["vector_buffer.h"],
    deps = [":buffer"],
)

tachyon_cc_unittest(
    name = "buffer_unittests",
    srcs = ["buffer_unittest.cc"],
    deps = [
        ":copyable",
        ":vector_buffer",
    ],
)
